package dev.yorkecao.demo.alibaba.cloud.web;

import dev.yorkecao.demo.alibaba.cloud.service.DubboService;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
public class NacosConsumerController {

    @Reference
    private DubboService dubboService;

    @Value("${spring.application.name}")
    private String appName;

    @GetMapping("/echo/app-name")
    public String echoAppName() {
        return dubboService.echo(appName);
    }
}
